<template>
    <section class="table-common">
			 	 <el-table
				    :data="tableData"
				    stripe
				    style="width: 100%">
				    
				 	<el-table-column
						 label="序号"
						 align="center"
					      >
					      	<template slot-scope="scope">
						        <span style="margin-left: 10px">{{ scope.$index+1}}</span>
						    </template>
				    </el-table-column>
				    
				    <el-table-column
				    	align="center"
				    v-for = "(val,key) in tableLabel"
				      :prop="key"
				      :label="val"
				      >
				    </el-table-column>
				    
				    <el-table-column
				    	align="center"
						 label="操作"
					      >
					      	<template slot-scope="scope">
						        <span v-if="currentType!='serverRegister'"  v-show="!scope.row.qiYong" style="margin-left: 10px" @click="scope.row.qiYong = !scope.row.qiYong"><img src="../../../images/server01.png"/></span>
						        <span v-if="currentType!='serverRegister'"  v-show="scope.row.qiYong" style="margin-left: 10px" @click="scope.row.qiYong = !scope.row.qiYong"><img src="../../../images/server05.png"/></span>
						        <span v-if="currentType==='serverRegister'" @click="pushServer(scope)">发布服务</span>
						        <span style="margin-left: 10px" @click="edit" ><img src="../../../images/server02.png"/></span>
						        <span style="margin-left: 10px" @click="detail"><img src="../../../images/server03.png"/></span>
						        <span style="margin-left: 10px" @click="del"><img src="../../../images/server04.png"/></span>
						    </template>
				    </el-table-column>

  </el-table>
        
    </section>
</template>

<script>
    import server01 from "../../../images/server01.png";
    export default {
    	props:{
    		currentType:{
    			type: String,
    			default: 'shareServer',
    			required: false
    		},
    		tableData:Array,
    		tableLabel:Object,
    	},
        data() {
          return {
          	
          };
        },
        methods: {
        		show(scope){
        			console.log(scope);
        		},
        		del(){
        		  this.$confirm('是否删除?', '提示', {
			          confirmButtonText: '确定',
			          cancelButtonText: '取消',
			          type: 'warning'
			        }).then(() => {
			          this.$message({
			            type: 'success',
			            message: '删除成功!'
			          });
			        }).catch(() => {
			          this.$message({
			            type: 'info',
			            message: '已取消删除'
			          });          
			        });
        		},
        		edit(){
        			this.$emit("edit");
        		},
        		detail(){
        			this.$emit("detail");
        		},
        		pushServer(scope){
        			this.$emit("pushServer",scope);
        		}
        }
  };
</script>

<style scoped="scoped">
    
</style>